<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>


<c:forEach items="${resume.internList}" var="intern">
    <c:if test="${!empty intern}">
    <div class="intern_info" style="display: block;">
        <span><b>${intern.companyName}</b></span>
        <span>&nbsp|&nbsp</span>
        <span class="intern_time"><fmt:formatDate value="${intern.startDate}" pattern="yyyy/MM/dd"/>-<fmt:formatDate
                value="${intern.endDate}" pattern="yyyy/MM/dd"/></span></br>
        <span><b>${intern.companyIndustry}</b></span>
        <span>&nbsp|&nbsp</span>
        <span><b>${intern.title}</b></span></br>
        <span><b>内容：</b>${intern.content}</span>
        <div class="button_edit">
            <button type="button" value="${intern.id}" id="button_intern_edit_${intern.id}"
                    onclick="edit_intern(this)" border="1px">编辑</button>
        </div>
        <div class="button_del">
            <button type="button" value="${intern.id}" id="button_intern_del_${intern.id}"
                    onclick="del_intern(this.value)" border="1px">删除</button>
        </div>
    </div>
    </c:if>
</c:forEach>
<script>
        function edit_intern(obj){
            let id=obj.value;
            console.log("obj:"+id)
        $("#intern_edit").load("/hire/resume/intern_edit_update", {id:id});
        $("#intern_info").hide();
        $("#intern_edit").show();
        }
    // $("#button_intern_del").click(function () {
        function del_intern(obj){
            console.log("internId:"+obj)
        $.post('/hire/resume/intern/delete',{internId:obj},function (res) {
            // console.log(1)
            if (res.code == '200') {
                let resumeId = $("#resumeId").val();
                console.log(resumeId)
                $("#intern_info").load("/hire/resume/intern_info", {id: resumeId});
                // $("#intern_info").remove();
                $("#intern_edit").hide();
            } else {
                layer.msg("删除失败!")
            }
        })
        }
    // })
</script>